package com.itheima.ai.repository;

import com.itheima.model.ai.pojos.ChatSession;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface ChatSessionRepository extends MongoRepository<ChatSession, String> {
    
    /**
     * 根据用户ID查询会话列表
     */
    List<ChatSession> findByUserIdAndDeletedOrderByUpdateTimeDesc(Long userId, Boolean deleted);
    
    /**
     * 根据用户ID和会话ID查询
     */
    Optional<ChatSession> findByIdAndUserId(String id, Long userId);
}

